<?
  require('functions.inc.php');

  function getPraxen() {
    $result = mysqli_query($_SESSION['db_connection'], "SELECT * FROM praxen;");
    while ($row = mysqli_fetch_assoc($result))
    {
      echo "<a href=\"detail.php?type=praxis&id=".$row['id']."\" name=\"btn_menu\">".$row['name']."</a>";
    }
  }

  function getAerzte() {
    $result = mysqli_query($_SESSION['db_connection'], "SELECT * FROM aerzte;");
    while ($row = mysqli_fetch_assoc($result))
    {
      echo "<a href=\"detail.php?type=arzt&id=".$row['id']."\" name=\"btn_menu\">".$row['titel']." ".$row['name']."</a>";
    }
  }

  if (!isset($_GET['list']))
  {
    eval("print(\"".gettemplate("menu")."\");");
    echo "<div id=\"menu_list\">";
    getPraxen();
    echo "</div>";
  }
  else if ($_GET['list'] == 'praxen')
  {
    getPraxen();
  }
  else
  {
    getAerzte();
  }

  eval("print(\"".gettemplate("menu_buttons")."\");");
?>
